package com.ldw.controller;

import com.ldw.pojo.Category;
import com.ldw.service.CategoryService;
import com.ldw.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("categorys")
public class CategorysController {

    @Autowired
    private CategoryService categoryService;

    @GetMapping
    public Result category() {
        return categorys();
    }

    @GetMapping("/detail")
    public Result categorys() {
        return categoryService.categorys();
    }

    @GetMapping("/detail/{id}")
    public Result categoryById(@PathVariable("id") Long id) {
        return categoryService.categoryById(id);
    }
}
